﻿using jbt.CodeCandy.AsTrEAM.Contracts;
using System;
using System.ServiceModel;
using System.Threading.Tasks;

namespace jbt.CodeCandy.AsTrEAM
{
    /// <summary>
    /// Allows an object to connect to an <see cref="IStreamManagerService"/>.
    /// </summary>
    [ServiceContractAttribute]
    public interface IStreamManagerServiceClient : IDisposable
    {
        /// <summary>
        /// Connects to <see cref="IStreamManagerService.Download"/> method synchronously.
        /// </summary>
        [OperationContractAttribute(Action = Settings.WCF.Namespage + "/IStreamManagerService/Download", ReplyAction = Settings.WCF.Namespage + "/IStreamManagerService/DownloadResponse")]
        [FaultContractAttribute(typeof(StreamFault), Action = Settings.WCF.Namespage + "/IStreamManagerService/DownloadFileFaultFault", Name = "FileFault", Namespace = "http://schemas.datacontract.org/2004/07/jbt.CodeCandy.AsTrEAM.Contracts")]
        StreamData Download(StreamDownloadRequest fileRequest);

        /// <summary>
        /// Connects to <see cref="IStreamManagerService.Download"/> method asynchronously.
        /// </summary>
        [OperationContractAttribute(Action = Settings.WCF.Namespage + "/IStreamManagerService/Download", ReplyAction = Settings.WCF.Namespage + "/IStreamManagerService/DownloadResponse")]
        Task<StreamData> DownloadAsync(StreamDownloadRequest fileRequest);

        /// <summary>
        /// Connects to <see cref="IStreamManagerService.Upload"/> method synchronously.
        /// </summary>
        [OperationContractAttribute(Action = Settings.WCF.Namespage + "/IStreamManagerService/Upload", ReplyAction = Settings.WCF.Namespage + "/IStreamManagerService/UploadResponse")]
        [FaultContractAttribute(typeof(StreamFault), Action = Settings.WCF.Namespage + "/IStreamManagerService/UploadFileFaultFault", Name = "FileFault", Namespace = "http://schemas.datacontract.org/2004/07/jbt.CodeCandy.AsTrEAM.Contracts")]
        NewStreamResult Upload(StreamData fileData);

        /// <summary>
        /// Connects to <see cref="IStreamManagerService.Upload"/> method asynchronously.
        /// </summary>
        [OperationContractAttribute(Action = Settings.WCF.Namespage + "/IStreamManagerService/Upload", ReplyAction = Settings.WCF.Namespage + "/IStreamManagerService/UploadResponse")]
        Task<NewStreamResult> UploadAsync(StreamData fileData);
    }
}